<template>
    <section class="index">
  		<p class="title">个人征信查询</p>
  		<div class="" style="text-align: center;margin: 90px auto;width: 250px;">
  			<input name='pic[]'  id='pic'  type='file' class='type-file-file' accept='image/*'  style='display: none;' value='' @change="upperCase($event)">
  			<img class="upload" :src="img1" @click="upload" width="100%"/>
  			<span class="search" @click="routerTo">查询</span>
  		</div>
  		
    </section>
</template>

<script>
    import img1 from '../assets/upload.png'
    export default {
        data() {
          return {
          		img1:img1,
          };
        },
        methods: {
        	upload(){
        		document.getElementById("pic").click();
        	},
        	upperCase(obj){
        		console.log(obj);
        		var objUrl = this.getObjectURL(obj.target.files[0]) 
        		console.log(objUrl)
        		this.img1=objUrl;
        	},
        	getObjectURL(file){/*获取本地路径*/
        		let url = null ;
				if (window.createObjectURL!=undefined) { // basic
				url = window.createObjectURL(file) ;
				} else if (window.URL!=undefined) { // mozilla(firefox)
				url = window.URL.createObjectURL(file) ;
				} else if (window.webkitURL!=undefined) { // webkit or chrome
				url = window.webkitURL.createObjectURL(file) ;
				}
				return url ;
       		},
	       	routerTo(){
	       		this.$router.push({name:'detail'});
	       	}
        }
  };
</script>

<style scoped="scoped">
	
     .index{
    	background: url(../assets/bg.png);
    	background-repeat:no-repeat; 
    	background-size:100% 100%;
    	-moz-background-size:100% 100%;
    	position: relative;
    }
    .index{
		height: 100%;
		position: relative;
		overflow: hidden;
	}
	.title{
		 color: #fff;
	    font-size: 35px;
	    text-align: center;
	    margin: 50px;
	    letter-spacing: 1px;
	}
	.index img{
		cursor: pointer;
	}
	.search{
		 width: 100%;
	    height: 45px;
	    background: blue;
	    display: inline-block;
	    line-height: 45px;
	    border-radius: 800px;
	    color: #fff;
	    letter-spacing: 2px;
	    margin-top: 20px;
	}
	      
</style>